<%--
  Created by IntelliJ IDEA.
  User: LSK
  Date: 2019/10/15
  Time: 14:50
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
  <base target="_blank" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>西安学车管家</title>
  <!--<link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css">-->
  <link rel="shortcut icon" href="img/bitbug_favicon.ico">
  <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">

  <link href="css/animate.css" rel="stylesheet">
  <link href="css/style.css?v=4.1.0" rel="stylesheet">
</head>
<style>
  /* .login
    {
      /*margin-top: 30%;*/
  /*  margin-left: 45%;
      margin-right: 15%;
    }
    body
    {
      background: #2aabd2;
    }
    #title
    {
      padding-left: 20%;
    }
    span
    {
      font-weight: bold;
      color: red;
    }
    #btn1
    {
      padding-left: 10%;
      padding-right: 10%;
    }*/
</style>

<body>
<!--格栅布局测试-->
<!--轮播图-->

<!--
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">-->
<!-- Indicators -->
<!--<ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>-->

<!-- Wrapper for slides -->
<!--
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="img/1.png" alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item">
      <img src="img/2.png" alt="...">
      <div class="carousel-caption">

      </div>
    </div>
    ...
  </div>
  -->
<!-- Controls -->
<!--<a target='_blank'  class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a target='_blank'  class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
-->


<!--<div class="container login">
  <h2 id="title">驾校保单管理系统</h2>-->
<!--pageContext.request.contextPath/login-->
<!--
  取消了ajax认证，后端认证不通过的话重定向到index.jsp
  -->
<!--
  <form class="form-horizontal" action="" onsubmit="return check()" method="post">
    <div class="form-group">
      <label for="user" class="col-sm-2 control-label">用户名</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="user" name="user" placeholder="在此输入用户名">
        <span id="usercheck"></span>
      </div>
    </div>
    <div class="form-group">
      <label for="pass" class="col-sm-2 control-label">密码</label>
      <div class="col-sm-10">
        <input type="password" class="form-control" id="pass" name="pass" placeholder="在此输入密码">
        <span id="passwdcheck"></span>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-5 col-sm-10">
        <button id="btn1" type="submit" class="btn btn-default" >登录</button>
      </div>
    </div>
  </form>
</div>-->
<div class="middle-box text-center loginscreen  animated fadeInDown">
  <div>
    <div>

      <!--<h1 class="logo-name">H+</h1>-->
      <img style="width:300px;height:100px" src="img/logo.png">
    </div>
    <h3>欢迎使用西安学车管家</h3>


    <form method="post" class="m-t" role="form" action="${pageContext.request.contextPath}/login"
          onsubmit="return check()">
      <div class="form-group">
        <input type="text" id="user" name="user" class="form-control" placeholder="用户名" required="">
        <span id="usercheck"></span>
      </div>
      <div class="form-group">
        <input type="password" id="pass" name="pass" class="form-control" placeholder="密码" required="">
        <span id="passwdcheck"></span>
      </div>
      <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>


      <!--<p class="text-muted text-center"> <a target='_blank'  href="login.html#"><small>忘记密码了？</small></a> | <a target='_blank'  href="register.html">注册一个新账号</a>
      </p>
-->
    </form>
  </div>
</div>
<div class="row" style=" left: 45%;text-align:center;position: absolute;bottom: 0;">
  <p class="comment-footer-org">
  <p>西安学车管家网络科技有限公司</p>
  <p>陕ICP备19023271号</p>
  </p>
  <!--<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010502037619"
     style="display:inline-block;text-decoration:none;height:20px;line-height:20px;">
    <img src="https://img.58cdn.com.cn/dist/jxedt/pc/products/user/images/beian.png" style="float:left;">
    <p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">京公网安备
      11010502037619号
    </p>
  </a>-->
</div>
<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>
<script>
  //表单认证
  /*
  权限管理：学员通过手机号查看自己的信息，管理员通过"admin"查看所有学员的信息(通过拦截器过滤)
  登录之后将学员手机号码写入session
  */
  function login() {

  }

  function check() {
    var user = $("#user").val();
    var pass = $("#pass").val();
    console.log(user);
    console.log(user.substring(5, 11));
    console.log(pass);
    if (user === "jiaxiaobao" && pass.length !== 10) {
      $("#passwdcheck").text("密码错误,请重新输入管理员密码");
      return false;
    } else if (user === "jiaxiaobao" && pass.length === 10) {
      //alert("管理员:登录成功");
      $("#passwdcheck").text("");
      $("#usercheck").text("");
      return true;
    } else {
      if (user.length === 0 || pass.length === 0) {
        //alert("请认真填写，用户名和密码均不能为空");
        $("#usercheck").text("用户名不能为空");
        $("#passwdcheck").text("密码不能为空");
        return false;
      } else if (user.length !== 11) {
        $("#usercheck").text("用户名为11位手机号");
        $("#passwdcheck").text("");
        //alert("用户不存在,请检测后重写输入(用户名为11位手机号)");
        return false;
      }
      //13812341234 6-10
      else if (user.substring(5, 11) !== pass) {
        $("#usercheck").text("");
        $("#passwdcheck").text("[前端认证]密码错误,请检测后重新输入");
        //alert("密码错误,请检测后重新输入");
        return false;
      }
      /*else {
               return true;
             }*/
      return true;
    }
    /*else
    {

      $.ajax({

        type:"POST" ,
        data:{"user":user},
        success:function (data) {
          //跳转新网页
          //因为种种原因，改行代码注释之后放在了js代码块的最后一行
          alert("登录成功");
        },
        error:function () {
          $("#usercheck").text("[后端]账号不存在");
          $("#passwdcheck").text("[后端]账号不存在");
          return false;
        },

        dataType:"text"
      });
      return true;
    }*/

  }
  ///login
  //<%--url:"${pageContext.request.contextPath}/login" ,--%>
</script>
<script>
  /* 鼠标特效 */
  var a_idx = 0;
  jQuery(document).ready(function ($) {
    $("body").click(function (e) {
      var a = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
      var $i = $("<span/>").text(a[a_idx]);
      a_idx = (a_idx + 1) % a.length;
      var x = e.pageX,
              y = e.pageY;
      $i.css({
        "z-index": 9999999999999999999999999999999999999999,
        "top": y - 20,
        "left": x,
        "position": "absolute",
        "font-weight": "bold",
        "color": "#ff6651"
      });
      $("body").append($i);
      $i.animate({
                "top": y - 180,
                "opacity": 0
              },
              1500,
              function () {
                $i.remove();
              });
    });
  });
  //alert("用户名不存在，请联系管理员");
</script>
<script>
  /* 鼠标特效 */
  var a_idx = 0;
  jQuery(document).ready(function ($) {
    $("body").click(function (e) {
      var a = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
      var $i = $("<span/>").text(a[a_idx]);
      a_idx = (a_idx + 1) % a.length;
      var x = e.pageX,
              y = e.pageY;
      $i.css({
        "z-index": 9999999999999999999999999999999999999999,
        "top": y - 20,
        "left": x,
        "position": "absolute",
        "font-weight": "bold",
        "color": "#ff6651"
      });
      $("body").append($i);
      $i.animate({
                "top": y - 180,
                "opacity": 0
              },
              1500,
              function () {
                $i.remove();
              });
    });
  });
  //alert("用户名不存在，请联系管理员");
</script>
</body>

</html>